﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MySql.Data.MySqlClient;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
/// <summary>
/// Summary description for addcb
/// </summary>
public class addCombobox : System.Web.UI.Page
{
   
	public static void addcb(DropDownList cb,string sql,string columselect)
	{
        //DatabaseHandler db = new DatabaseHandler();


        MySqlConnection con = new MySqlConnection(DatabaseHandler.strConnect);
        con.Open();


        MySqlDataAdapter ad = new MySqlDataAdapter(sql, con);
        DataSet ds = new DataSet();
        ad.Fill(ds, "tbl");



        for (int i = 0; i < ds.Tables["tbl"].Rows.Count; i++)
        {
            DataRow dr;
            dr = ds.Tables["tbl"].Rows[i];

            cb.Items.Add(dr[columselect].ToString());
        }

    
	}
}